﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

namespace RealEstateCenter
{
    public partial class AddCustomer : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection sqlconnect = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
            SqlCommand cmd = new SqlCommand("insert into Customer(customer_name, customer_tel_no , customer_mail) values('" + customer_name.Text + "','"+ customer_tel_no.Text + "','" + customer_mail.Text+"')", sqlconnect);
            sqlconnect.Open();
            int kontrol = cmd.ExecuteNonQuery();
            if (kontrol == 1)
            {
                Response.Redirect("ListCustomers.aspx");
            }
        }
    }
}